<?php
/**
 * Created by PhpStorm.
 * User: 9ey
 * Date: 2019/4/19
 * Time: 22:25
 */

namespace App\Utils;


class Helpers
{
    /**
     * 密码强度
     * @param $pass
     * @return int
     */
     static function passStrength($pass)
    {
        $score = 0;
        //数字
        if (preg_match("/\d+/", $pass)) {
            $score++;
        }
        //小写字母
        if (preg_match("/[a-z]+/", $pass)) {
            $score++;
        }
        //大写字母
        if (preg_match("/[A-Z]+/", $pass)) {
            $score++;
        }
        //字符
        if (preg_match("/[_|\-|+|=|*|!|@|#|$|%|^|&|(|)]+/", $pass)) {
            $score++;
        }
        return $score;
    }
}